﻿using UnityEngine;
using System.Collections;
using DICE_GS;

public class RandomBoxItem : MonoBehaviour {
	[HideInInspector]
	public RandomBoxSelectWindow window;

	public UILabel itemName;
	public UILabel itemAmount;

	public GameObject questionMark;
	public UISprite itemImage;

	public GameObject selectedMark;

	public int index;

	[HideInInspector]
	public bool isEmpty = false;
	
	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
	
	}

	public void SetItemInfos(BoxCategory category, int boxID, int amount )
	{
		if( CItemDataManager.Instance.GetItemData(boxID).id == 2 )
		{
			itemName.text = "COIN";
			itemAmount.text = amount.ToString();
			itemImage.spriteName = "icon_shop_gold_pack_02";
		}
		else if( CItemDataManager.Instance.GetItemData(boxID).id == 1 )
		{
			itemName.text = "DIAMOND";
			itemAmount.text = amount.ToString();
			itemImage.spriteName = "icon_shop_diamond_pack_02";
		}

		itemName.gameObject.SetActive(false);
		itemAmount.gameObject.SetActive(false);
		itemImage.gameObject.SetActive(false);
	}

	void OnClick()
	{
//		selectedMark.SetActive(true);
		window.SelecteBox(index, index, selectedMark);
	}
}
